let fromPath = ''
export default {
  created() {
    window.addEventListener('popstate', this.handlePopstate)
  },
  beforeRouteLeave(to, from, next) {
    fromPath = from.path
    next()
  },
  beforeDestroy() {
    window.removeEventListener('popstate', this.handlePopstate)
  },
  methods: {
    handlePopstate() {
      let role = JSON.parse(
        window.localStorage.getItem('attendance-records')
      ).role
      // alert(fromPath)
      // console.log('screenshow >>>>>>.......', this.screenS)
      if (
        fromPath == '/outsourcingNewApply' ||
        fromPath == '/workbench' ||
        fromPath == '/login' ||
        (fromPath == '/settingPage' && role == 2)
      ) {
        // alert('新申请物理返回')
        this.finishInApp()
      }
    }
  },
  watch: {}
}
